var portrait = function(fun){
    var width = document.documentElement.clientWidth;
    var height = document.documentElement.clientHeight;
    var screen_width = width; //屏幕宽度
    if (width < height) {
        screen_width = height; //如果 是竖屏，灵感的宽度就等于屏高
        var contentDOM = document.getElementById('content');
        contentDOM.style.width = height + 'px';
        contentDOM.style.height = width + 'px';
        contentDOM.style.top = (height - width) / 2 + 'px';
        contentDOM.style.left = 0 - (height - width) / 2 + 'px';
        contentDOM.style.transform = 'rotate(90deg)';
        
        window.W = height;
        window.H = width;
        fun(1)
    } else {
        screen_width = height; //如果 是竖屏，灵感的宽度就等于屏高
        var contentDOM = document.getElementById('content');
        contentDOM.style.width = width  + 'px';
        contentDOM.style.height = height + 'px';
        contentDOM.style.transform = 'none';
        
        window.W = width;
        window.H = height;
        fun()
    }
    
    //根据手机旋转的角度来判断
    var evt = "onorientationchange" in window ? "orientationchange" : "resize"; //旋转事件
    window.addEventListener(evt, function () { //事件监听        
        location.reload()
    }, false);
}